package com.gameplatform.common.enums;

import lombok.Getter;

@Getter
public enum ResultCodeEnum {
    // 成功
    SUCCESS(200, "操作成功"),

    // 客户端错误 4xx
    PARAM_ERROR(400, "参数错误"),
    UNAUTHORIZED(401, "未登录或token已过期"),
    FORBIDDEN(403, "无权限"),
    NOT_FOUND(404, "资源不存在"),
    METHOD_NOT_ALLOWED(405, "请求方法不允许"),
    
    // 服务器错误 5xx
    ERROR(500, "服务器错误"),
    SERVICE_UNAVAILABLE(503, "服务不可用"),
    
    // 用户相关错误 1xxx
    USER_NOT_EXIST(1001, "用户不存在"),
    USER_ALREADY_EXIST(1002, "用户已存在"),
    PASSWORD_ERROR(1003, "密码错误"),
    TOKEN_EXPIRED(1004, "token已过期"),
    TOKEN_INVALID(1005, "token无效"),
    
    // 游戏相关错误 2xxx
    ROOM_FULL(2001, "房间已满"),
    ROOM_NOT_EXIST(2002, "房间不存在"),
    GAME_NOT_START(2003, "游戏未开始"),
    GAME_ALREADY_START(2004, "游戏已开始"),
    NOT_YOUR_TURN(2005, "不是您的回合"),
    INVALID_MOVE(2006, "非法操作"),
    
    // 系统错误 3xxx
    SYSTEM_ERROR(3001, "系统错误"),
    NETWORK_ERROR(3002, "网络错误"),
    DATABASE_ERROR(3003, "数据库错误"),
    CACHE_ERROR(3004, "缓存错误");

    private final int code;
    private final String message;

    ResultCodeEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }
} 